Skip to content

ci(async-audit): wire async-route audit hook in disabled state (Phase 1)#93

Merged
pcalnon merged 1 commit intomainfrom
ci/async-route-audit-phase-1-wiring
May 6, 2026
Merged

ci(async-audit): wire async-route audit hook in disabled state (Phase 1)#93
pcalnon merged 1 commit intomainfrom
ci/async-route-audit-phase-1-wiring

Conversation

@pcalnon
Copy link
Copy Markdown
Owner

@pcalnon pcalnon commented May 6, 2026

Summary

Phase 1 wiring of the async-route audit hook (BUG-JD-10 class
prevention) for juniper-data. Adds a ruff-based pre-commit hook
scoped to the `ASYNC` ruleset, stage-restricted to `manual`
so it doesn't fire on regular commits.

First of four Phase 1 wiring PRs. Order per the migration plan
(`ASYNC_ROUTE_AUDIT_HOOK_MIGRATION_PLAN.md`
§4): data → cascor → canopy → worker.

What's added

```yaml

  • id: ruff
    alias: ruff-async-audit
    name: Async-route audit (BUG-JD-10 class)
    args: [--select, ASYNC, --exit-zero]
    files: ^juniper_data/.*\.py$
    stages: [manual]
    ```

  • `alias: ruff-async-audit` lets us reference the hook
    independently of the existing `ruff` and `ruff-format` hooks
    for invocation and Phase-2 enablement.

  • `--exit-zero` means violations are reported but don't fail
    the hook in Phase 1 (the disabled-state contract).

  • No `pyproject.toml` change — `[tool.ruff.lint] select` stays
    unchanged so regular runs don't enforce `ASYNC` yet.

  • No CI workflow change in this PR; CI lane lands in Phase 2.

How to use

```bash

Show the 3 enumerated violations on demand:

pre-commit run --hook-stage manual ruff-async-audit --all-files
```

Verified locally to surface all 3 violations from the Phase 0
enumeration (`juniper_data/api/app.py:46`, `juniper_data/api/routes/health.py:131` and `:132` — all `ASYNC240` pathlib-in-async).

What's next

  • Phase 2 (next, this repo): flip `stages` to
    `[pre-commit, manual]`, add CI lane with
    `continue-on-error: true`.
  • Phase 3: fix the 3 production violations (estimated 30 min
    per the Phase 0 doc).
  • Phase 4: flip CI lane to hard-fail; add hook to active
    pre-commit stages.

Test plan

  • `pre-commit run --hook-stage manual ruff-async-audit --all-files`
    surfaces 3 violations (no false positives, no missed sites).
  • Regular `pre-commit run` does NOT fire the new hook —
    verified by running on `juniper_data/api/routes/health.py`
    and confirming only `ruff` and `ruff-format` ran.
  • No code changes; pre-commit config only.

🤖 Generated with Claude Code

Adds a ``ruff-async-audit`` pre-commit hook scoped to the Phase 0
ASYNC ruleset (3 violations enumerated in
juniper-ml/notes/ASYNC_ROUTE_VIOLATIONS_2026-05-06.md). ``stages:
[manual]`` keeps it from firing on regular commits; on-demand via:

    pre-commit run --hook-stage manual ruff-async-audit

Used as a Phase-2 stepping stone — Phase 2 will flip
``stages: [pre-commit, manual]`` and add a soft-fail CI lane so
PRs see violations as annotations without blocking merge.
Phase 4 hard-fails.

The ``--exit-zero`` flag means violations are reported but don't
fail the hook in Phase 1; that's the disabled-state contract.

This is the first of four Phase 1 wiring PRs (one per in-scope
repo). Order per the migration plan: data → cascor → canopy →
worker.

Plan: notes/ASYNC_ROUTE_AUDIT_HOOK_MIGRATION_PLAN.md (juniper-ml)
§4 Phase 1.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Owner Author

@pcalnon pcalnon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved

@pcalnon pcalnon merged commit 9a3a7bb into main May 6, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant